#include <cstdio>
#include <cmath>

using namespace std;

typedef long long ll;
const int maxa=10000000, maxsize=30000000;

bool npri[maxa+2];
int num[maxa + 2];

void initPri(int n) {
  num[0] = 0;
  for (int i = 2; i <= n; i++) {
    if (!npri[i])
      num[++num[0]] = i;
    for (int j = 1; j <= num[0] && i * num[j] <= n; j++) {
      npri[i * num[j]] = true;
      if (i % num[j] == 0)
        break;
    }
  }
}

int qpower(int a, int n, int mod) {
    int s=1;
    for (; n; n/=2) {
        if (n&1) s=(ll)s*a%mod;
        a=(ll)a*a%mod;
    }
    return s;
}

bool check(int x) {
    int n=x;
    if (npri[n+1]) return false;
    for (int i=1; i<=num[0] && num[i]<=sqrt(x); i++) {
        if (x%num[i]==0) {
            if (qpower(2, n/num[i], n+1)==1) return false;
        }
        for (; x%num[i]==0; x/=num[i]);
    }
    return !(x>1 && qpower(2, n/x, n+1)==1);
}

int main() {
  freopen("world.in", "r", stdin);
  freopen("world.out", "w", stdout);

  int n;
  scanf("%d", &n);
  initPri(n+1);

  double ans=0;
  for (int i = 2; i <= n; i += 2) {
      if (check(i)) ans += (double)i/(n/2);
  }

  printf("%.5lf\n", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
